﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.ComponentModel;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Org.Eurekaa.DNJ.UI.WebControls
{
    [
        ToolboxData("<{0}:DNJThemeEntry runat=server></{0}:DNJThemeEntry>"),
        ParseChildren(true),
        ToolboxItem(false),
        PersistChildren(false)
    ]
    public class DNJTheme : PlaceHolder
    {
        HtmlAnchor cssAnchor = new HtmlAnchor();
        HtmlImage thumbnail = new HtmlImage();
        HtmlGenericControl title = new HtmlGenericControl("span");

//        private string thumbnail = "";

        [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string Thumbnail
        {
            get { return thumbnail.Src; }
            set { thumbnail.Src = value; }
        }

//        private string title = "";
        public String Title
        {
            get { return title.InnerText; }
            set { title.InnerText = value; }
        }

        //private string cssUrl = "";
        [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string CssUrl
        {
            get { return cssAnchor.HRef; }
            set { cssAnchor.HRef = value; }
        }

        public DNJTheme()
        {
            

        }

        protected override void CreateChildControls()
        {
            //base.CreateChildControls();
            Controls.Clear();
            cssAnchor.Controls.Add(thumbnail);
            cssAnchor.Controls.Add(title);
            Controls.Add(cssAnchor);
        }

        //protected override void Render(HtmlTextWriter writer)
        //{
        //    title.RenderControl(writer);
        //    //base.Render(writer);
        //}


        #region not implemented properties
        [Browsable(false)]
        public override bool EnableTheming
        {
            get
            {
                return base.EnableTheming;
            }
            set
            {
                base.EnableTheming = value;
            }
        }

        [Browsable(false)]
        public override bool EnableViewState
        {
            get
            {
                return base.EnableViewState;
            }
            set
            {
                base.EnableViewState = value;
            }
        }

        [Browsable(false)]
        public override bool Visible
        {
            get
            {
                return base.Visible;
            }
            set
            {
                base.Visible = value;
            }
        }

        #endregion not implemented properties
    }




}
